<%@ page import="com.devicemantra.coordinate.dataobjects.*,java.util.*,com.google.appengine.api.datastore.KeyFactory" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="/css/tab.css" />
<script type="text/javascript">
function initXMLHttpClient() 
{
     var xmlhttp;
     try {
         // Mozilla / Safari / IE7
         xmlhttp = new XMLHttpRequest();
     } 
     catch (e) 
     {
          // IE
          var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0',
                                     'MSXML2.XMLHTTP.4.0',
                                     'MSXML2.XMLHTTP.3.0',
                                     'MSXML2.XMLHTTP',
                                     'Microsoft.XMLHTTP' );
        var success = false;
          for (var i=0;i < XMLHTTP_IDS.length && !success; i++) 
	  {
              try 
	    	{
                   xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
                      success = true;
                } catch (e) {}
          }
          if (!success) 
	  {
              throw new Error('Unable to create XMLHttpRequest.');
          }
      }
     return xmlhttp;
}

function dept_clicked(linkObj)
{
	alert(linkObj);
	
}

function test_parent(message)
{
	//alert(message);
	document.getElementById('message').innerHTML = message;
}

function init()
{
	document.getElementById('file_upload_form').onsubmit=function() {
	alert("init called now");
	document.getElementById('file_upload_form').target = 'upload_target'; //'upload_target' is the name of the iframe
	}
}

function js_clicked()
{
	//alert("clicked called now");
	document.getElementById('message').innerHTML = "Processing....";
	//alert(document.upload.dept_name.name);
	document.add_dept_form.submit();
}

function js_add_department()
{
	//alert("Called");
	var httpGetReq = initXMLHttpClient();
	httpGetReq.onreadystatechange =function() 
	{
		if(httpGetReq.readyState == 4)
   		{
        		if (httpGetReq.status==200)
        		{
          		//alert(httpGetReq.responseText);
          		//document.getElementById('anim_window').innerHTML = "";
          		document.getElementById('show_window').innerHTML = httpGetReq.responseText;
			}
		}
	}
	
	//alert("GET'ing getWindow.jsp?category=subdepartment&department=" + lSelectBox.options[lSelectBox.selectedIndex].text);
	httpGetReq.open("GET","/modules/administration/add_dept.jsp",true);
	httpGetReq.send(null);
	document.getElementById('show_window').innerHTML = "<img src=\"images/animation.gif\" alt=\"Processing...\" />"; 
}


</script>	
</head>


<body>
<ul id="tabmenu">
	<li><a href="/AdminController?id=country" onclick="dept_clicked(this.text); return false">Country</a></li>
	<li><a  href="/AdminController?id=states">States</a></li>
	<li><a class="active" href="/AdminController?id=department">Department</a></li>
	<li><a href="/AdminController?id=users">Users</a></li>
</ul>
<%
	System.out.println("In view_department.jsp - 1");
	CDepartment lDepartment = (CDepartment) request.getSession().getAttribute("DEPT");
	System.out.println("In view_department.jsp - 2 ");
	if( lDepartment == null )
	{
		out.println("ERROR: Department was not set by ViewDepartment servlet");
		return;
	}
	
	/*Format the Department object into a nice table */
%>
<br><br>
<table align=LEFT width=400>
<tr>
<td align=left ><img src=getImage?image_key=
<% 	System.out.println("In view_department.jsp - 3 ");
	out.print(lDepartment.getLogo().getKey()); 
%> 
/> &nbsp;&nbsp;&nbsp;<a href=""><% out.print(lDepartment.getDepartmentName()); System.out.println("In view_department.jsp - 4 ");%></a></font><br><br></td> 
</tr>
<tr>
<td>Description : <% out.print(lDepartment.getDescription()); System.out.println("In view_department.jsp - 5 ");%></td>
</tr>
<tr>
<td>Contact : <% /* out.print(lDepartment.getContactInfo().getName());  */ System.out.println("In view_department.jsp - 6 ");%></td>
</tr>
<tr>
<td>Designation : <% /*out.print(lDepartment.getContactInfo().getmDesignation()); */ System.out.println("In view_department.jsp - 7 ");%></td>
</tr>
<tr>
<td>Contact Number  : <% /* out.print(lDepartment.getContactInfo().getmContactNumber()); */ System.out.println("In view_department.jsp - 8 "); %><BR><BR></BR></BR></td>
</tr>
<tr>
<td align=center></BR></BR><a href="/modules/administration/department.jsp"/>Back</a></td>
</tr>
</table>	


</body>
</html>
